package com.giveme5.common.entity;

import java.util.HashMap;

public class SimpleResultMessage {

	public class CommonResultCode {
		// 处理成功
		public static final int SUCCESS = 0;
		// 未处理异常
		public static final int COMMON_ERROR = 1001;
		// 复制对象时出错
		public static final int COMMON_COPYERROR = 1002;
		// 数据校验错误
		public static final int COMMON_VALIDATION_ERROR = 1003;
		// 参数数据类型错误
		public static final int COMMON_ADAPTOR_ERROR = 1004;
	}

	private static HashMap<Integer, String> messages;

	static {
		messages = new HashMap<Integer, String>();
		messages.put(CommonResultCode.COMMON_ERROR, "未处理异常");
		messages.put(CommonResultCode.COMMON_COPYERROR, "复制异常");
		messages.put(CommonResultCode.COMMON_VALIDATION_ERROR, "数据校验错误");
		messages.put(CommonResultCode.COMMON_ADAPTOR_ERROR, "参数数据类型错误");
	}

	public static String getMessage(Integer code) {
		return messages.get(code);
	}

	public static void putMessage(Integer code, String message) {
		messages.put(code, message);
	}
}
